package net.adetech.crj.controller;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import net.adetech.crj.bean.WgrtbForm;
import net.adetech.crj.bean.ZggmtbForm;
import net.adetech.crj.bean.ZggmtbResult;
import net.adetech.crj.entity.User;
import net.adetech.crj.utils.ServiceUtil;
import net.adetech.framework.entity.ServiceRequest;
import net.adetech.framework.entity.ServiceResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;
import java.util.HashMap;
import java.util.Map;

@RestController
public class ServiceController {

    @Autowired
    ServiceUtil serviceUtil;


    @RequestMapping(value = "/eecmisws/unimethod",produces = "application/json")
    public String eecmisws(String funccode,String args)
    {
        ServiceRequest request = new ServiceRequest();
        Map<String,Object> params = new HashMap<String, Object>();
        params.put("args",args);
        params.put("funccode",funccode);
        request.setParams(params);
        ServiceResponse response = serviceUtil.call("interface.call",request);
        JSONObject apiResponse = (JSONObject) response.get("response");
        return apiResponse.toJSONString();
    }
}
